<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            border: 1px solid black;
            background: #e5e55e;
        }
    </style>
</head>
<body>
    <div></div>
    <button>改变正方形</button>
    <script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.6.3.js"></script>
    <script>
        $("button").click(function (){
            let w= $("div").width()
            $("div").width (2*w)
            $("div").height (2*w)
        })
        
    </script>
</body>
</html>